import axios from 'axios';
import {ElMessage} from "element-plus";
import {useLoginStore} from "@/stores/LoginStore.js";



const instance=axios.create({
    baseURL:"http://localhost:8848",
    timeout:5000,
});
instance.interceptors.request.use(config=>{
    config.headers['Content-Type']='application/json;charset=utf-8';
return config
},error => {
    console.log('request error:' + error)
    return Promise.reject(error)
})

instance.interceptors.response.use(response=>{
    let res=response.data
    return res

},error => {
    console.log('response error:' + error)
    return Promise.reject(error)
})


/**
 * get请求
 * @param {string} url  请求地址
 * @param {Object} params 请求参数
 * @param {Object} config 请求配置
 * @returns {Promise<axios.AxiosResponse<any>>}
 */

/**
 * 请求对象
 */
export default  instance;
